from InstallDbInterface import InstallDbInterface


class InstallDbForUos(InstallDbInterface):
    def __init__(self, config, env):
        self.config = config
        self.env = env
        self.download_url = 'https://issedb-5.obs.cn-north-4.myhuaweicloud.com/isseDB/centos-x86_64/issedb-5.0.1-CentOS-64bit-all.tar.gz'
        self.dependent_lib = ['zlib-devel',
                              'libaio',
                              'libuuid',
                              'readline-devel',
                              'krb5-libs',
                              'libicu',
                              'libxslt',
                              'tcl',
                              'perl',
                              'openldap',
                              'pam',
                              'openssl-devel',
                              'libxml2',
                              'bzip2',
                              'expect']
        self.params = {'fs.aio-max-nr': '1048576',
                       'fs.file-max': '76724600',
                       'kernel.sem': '4096 2097152000 4096 512000',
                       'kernel.shmall': '26843545',
                       'kernel.shmmax': '68719476736',
                       'kernel.shmmni': '819200',
                       'net.core.netdev_max_backlog': '10000',
                       'net.core.rmem_default': '262144',
                       'net.core.rmem_max': '4194304',
                       'net.core.wmem_default': '262144',
                       'net.core.wmem_max': '4194304',
                       'net.core.somaxconn': '4096',
                       'net.ipv4.tcp_fin_timeout': '5',
                       'vm.dirty_background_bytes': '409600000',
                       'vm.dirty_expire_centisecs': '3000',
                       'vm.dirty_ratio': '80',
                       'vm.dirty_writeback_centisecs': '50',
                       'vm.overcommit_memory': '0',
                       'vm.swappiness': '60',
                       'net.ipv4.ip_local_port_range': '40000 65535',
                       'fs.nr_open': '20480000'}
        self.limits_conf = {'issedb soft nproc unlimited',
                            'issedb hard nproc unlimited',
                            'issedb soft stack unlimited',
                            'issedb hard stack unlimited',
                            'issedb soft core unlimited',
                            'issedb hard core unlimited',
                            'issedb soft memlock unlimited',
                            'issedb hard memlock unlimited',
                            'issedb soft nofile 10240000',
                            'issedb hard nofile 10240000'
                            }

    def preinstall(self):
        pass

    def precheck(self):
        pass

    def install(self):
        pass

    def after_install(self):
        pass

